#ifndef __PICTURE_FIEL_STREAM_H__
#define __PICTURE_FIEL_STREAM_H__

#include <map>
#include <mutex>
#include <string>
#include <functional>
#include "Pal/VideoDec.h"
#include "Thread/Thread.h"
#include "StreamComposeMgr.h"
#include "Poller/Timer.h"

namespace Media{

const std::string  picturePath = "/mnt/sd/PictureFile/";
//const std::string  picturePath = "/nfsroot/StreamFile/PictureFile/";

const std::string  startupPath = "/user/data/StreamFile/PictureFile/";



const int CustomNum = 100;
const int DeviceStsMaster = 111;
const int DeviceStsSlave  = 112;

class VideoDecode;

class PictureFileStream{
public:

	static PictureFileStream *instance();

	bool stop();

	bool start(StreamPlayInfo playInfo, int curtainNum);

	bool timerTaskCb();
	
private:
	PictureFileStream();

	void ThreadProc(Fdt::Thread *thread);

	bool setDecPacket();

	bool setFormat(VideoDecFormat *format);

private:
	static PictureFileStream *              sm_streamIns;

	static std::mutex 			            sm_insMutex;
    
    VideoDecode *                           m_pVideoDecode;
	
	int                                     m_decodeChannel = -1;

	VideoDecPacket                          m_decodePacket;

	std::mutex                              m_fileMutex;

	std::string                             m_fileStreamName;

	std::shared_ptr<Fdt::Timer>             m_taskTimer;

	bool                                    m_started = false;//动标志,避免多个业务多次启停

    TaskInfo                                m_taskInfo = {0};
	
	Fdt::Thread 						    m_thread{"PictureFileStream"};//thread放在最后,保证thread最后构造,最先析构

};

}//namespace Media
#endif

